using DataDynamics.ActiveReports;
using DataDynamics.ActiveReports.Export.Xls;
using SM.core;
using SS;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
using TVSBH.core;
namespace TVSBH.func
{
	public class frmEqualDebt : Form
	{
		private Func objFunc = new Func();
		private DataTable objTable = new DataTable();
		private Bill objBill = new Bill();
		private Partner objPartner = new Partner();
		private string currPid = "";
		private string currCusID = "";
		private bool isPostBack = false;
		private IContainer components = null;
		private DataGridView dgvProduct;
		private Button btnPrint;
		private Button btnClose;
		private System.Windows.Forms.TextBox txtAllMoney;
		private DataGridView dgvBill;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
		private DataGridViewTextBoxColumn Column10;
		private DataGridViewTextBoxColumn Column11;
		private DataGridViewTextBoxColumn Column12;
		private DataGridViewTextBoxColumn Column13;
		private DataGridViewTextBoxColumn Column14;
		private DataGridViewTextBoxColumn Note;
		private DataGridViewTextBoxColumn TotalMoney;
		private System.Windows.Forms.Label label2;
		private Button btnExportToExcel;
		private GroupBox groupBox1;
		private System.Windows.Forms.TextBox txtSearch;
		private System.Windows.Forms.Label label1;
		private ComboBox cbbObject;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label17;
		private DateTimePicker dtpTo;
		private DateTimePicker dtpFrom;
		private System.Windows.Forms.Label label4;
		private DataGridViewTextBoxColumn Column7;
		private DataGridViewTextBoxColumn Column2;
		private DataGridViewTextBoxColumn firstBalance;
		private DataGridViewTextBoxColumn debtInTime;
		private DataGridViewTextBoxColumn MoneyHaveInTime;
		private DataGridViewTextBoxColumn CollectionInTime;
		private DataGridViewTextBoxColumn MoneyPayedInTime;
		private DataGridViewTextBoxColumn Balancer;
		private DataGridViewTextBoxColumn ProID;
		private DataGridViewTextBoxColumn CusID;
		public frmEqualDebt()
		{
			this.InitializeComponent();
		}
		private void frmDebtNeedIn_Load(object sender, EventArgs e)
		{
			this.cbbObject.SelectedIndex = 0;
			Program.strConnectionString = this.objFunc.strConnectionString;
			this.getData();
			this.isPostBack = true;
		}
		private void getData()
		{
			this.dgvProduct.AutoGenerateColumns = false;
			DataTable dataTable = new DataTable();
			DataColumn column = new DataColumn("Name", typeof(string));
			DataColumn column2 = new DataColumn("Address", typeof(string));
			DataColumn column3 = new DataColumn("Phone", typeof(string));
			DataColumn column4 = new DataColumn("DEBT", typeof(string));
			DataColumn column5 = new DataColumn("HAS", typeof(string));
			DataColumn column6 = new DataColumn("Money", typeof(string));
			DataColumn column7 = new DataColumn("ProID", typeof(string));
			DataColumn column8 = new DataColumn("CusID", typeof(string));
			dataTable.Columns.Add(column);
			dataTable.Columns.Add(column2);
			dataTable.Columns.Add(column3);
			dataTable.Columns.Add(column4);
			dataTable.Columns.Add(column5);
			dataTable.Columns.Add(column6);
			dataTable.Columns.Add(column7);
			dataTable.Columns.Add(column8);
			SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
			sqlConnection.Open();
			SqlCommand sqlCommand = sqlConnection.CreateCommand();
			SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
			SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
			sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
			sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
			sqlCommand.Parameters.Add(sqlParameter);
			sqlCommand.Parameters.Add(sqlParameter2);
			string str = "";
			if (this.txtSearch.Text.Trim() != "")
			{
				str = " AND Name LIKE N'%" + this.txtSearch.Text + "%' ";
			}
			if (this.cbbObject.SelectedIndex == 1)
			{
				sqlCommand.CommandText = "SELECT ((firstBalance + ISNULL(dbo.uf_getMoneyAddInTime_V0(CusID,@ObjDate1),0) + ISNULL(dbo.uf_getTotalMoneyPayedProvider_V0(CusID,@ObjDate1),0)) - (ISNULL([dbo].[uf_getDebtInTime_V0](CusID,@ObjDate1),0) + ISNULL([dbo].uf_getCollectionInTime_V0(CusID,@ObjDate1),0))) AS realFirstBalancer, ((((firstBalance + ISNULL(dbo.uf_getMoneyAddInTime_V0(CusID,@ObjDate1),0) + ISNULL(dbo.uf_getTotalMoneyPayedProvider_V0(CusID,@ObjDate1),0)) - (ISNULL([dbo].[uf_getDebtInTime_V0](CusID,@ObjDate1),0) + ISNULL([dbo].uf_getCollectionInTime_V0(CusID,@ObjDate1),0))) + ISNULL(dbo.uf_getMoneyAddInTime(CusID,@ObjDate1,@ObjDate2),0) - ISNULL(dbo.uf_getTotalMoneyPayedProvider(CusID,@ObjDate1,@ObjDate2),0)) - (ISNULL([dbo].[uf_getDebtInTime](CusID,@ObjDate1,@ObjDate2),0) + ISNULL([dbo].uf_getCollectionInTime(CusID,@ObjDate1,@ObjDate2),0))) AS Balancer, firstBalance, Name, CusID, Address, dbo.uf_getMoneyAddInTime(CusID,@ObjDate1,@ObjDate2) AS MoneyHaveInTime, dbo.uf_getTotalMoneyPayedProvider(CusID,@ObjDate1,@ObjDate2) AS MoneyPayedInTime, [dbo].[uf_getDebtInTime](CusID,@ObjDate1,@ObjDate2) AS DebtInTime, [dbo].uf_getCollectionInTime(CusID,@ObjDate1,@ObjDate2) AS CollectionInTime FROM [TabPartner] WHERE [IsProvider] = 1 " + str + " ORDER BY [Name]";
			}
			else
			{
				sqlCommand.CommandText = "SELECT ((firstBalance + ISNULL(dbo.uf_getMoneyAddInTime_V0(CusID,@ObjDate1),0) + ISNULL(dbo.uf_getTotalMoneyPayedProvider_V0(CusID,@ObjDate1),0)) - (ISNULL([dbo].[uf_getDebtInTime_V0](CusID,@ObjDate1),0) + ISNULL([dbo].uf_getCollectionInTime_V0(CusID,@ObjDate1),0))) AS realFirstBalancer, ((((firstBalance + ISNULL(dbo.uf_getMoneyAddInTime_V0(CusID,@ObjDate1),0) + ISNULL(dbo.uf_getTotalMoneyPayedProvider_V0(CusID,@ObjDate1),0)) - (ISNULL([dbo].[uf_getDebtInTime_V0](CusID,@ObjDate1),0) + ISNULL([dbo].uf_getCollectionInTime_V0(CusID,@ObjDate1),0))) + ISNULL([dbo].[uf_getDebtInTime](CusID,@ObjDate1,@ObjDate2),0) + ISNULL([dbo].uf_getCollectionInTime(CusID,@ObjDate1,@ObjDate2),0)) - (ISNULL(dbo.uf_getMoneyAddInTime(CusID,@ObjDate1,@ObjDate2),0) - ISNULL(dbo.uf_getTotalMoneyPayedProvider(CusID,@ObjDate1,@ObjDate2),0))) AS Balancer, firstBalance, Name, CusID, Address, dbo.uf_getMoneyAddInTime(CusID,@ObjDate1,@ObjDate2) AS MoneyHaveInTime, dbo.uf_getTotalMoneyPayedProvider(CusID,@ObjDate1,@ObjDate2) AS MoneyPayedInTime, [dbo].[uf_getDebtInTime](CusID,@ObjDate1,@ObjDate2) AS DebtInTime, [dbo].uf_getCollectionInTime(CusID,@ObjDate1,@ObjDate2) AS CollectionInTime FROM [TabPartner] WHERE [IsCustomer] = 1 AND [IsProvider] = 0" + str + " ORDER BY [Name]";
			}
			SqlDataAdapter sqlDataAdapter = new SqlDataAdapter();
			sqlDataAdapter.SelectCommand = sqlCommand;
			DataSet dataSet = new DataSet();
			sqlDataAdapter.Fill(dataSet);
			sqlConnection.Close();
			sqlConnection.Dispose();
			this.btnPrint.Enabled = true;
			this.objTable = dataSet.Tables[0];
			double num = 0.0;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				num += double.Parse(this.objTable.Rows[i]["Balancer"].ToString());
			}
			this.dgvProduct.DataSource = this.objTable;
			this.txtAllMoney.Text = string.Format(Program.lenAffterDecimal, num);
			if (this.dgvProduct.Rows.Count > 0)
			{
				this.btnPrint.Enabled = true;
				this.btnExportToExcel.Enabled = true;
			}
			else
			{
				this.btnPrint.Enabled = false;
				this.btnExportToExcel.Enabled = false;
			}
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmDebtNeedIn_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
			else
			{
				if (e.KeyCode == Keys.F7)
				{
					this.btnPrint.PerformClick();
				}
			}
		}
		private void ckbProviderAll_CheckedChanged(object sender, EventArgs e)
		{
			this.getData();
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
			frmRepEqualDebt.reportRangeTime = "Từ ngày : " + this.dtpFrom.Text + " đến " + this.dtpTo.Text;
			if (this.cbbObject.SelectedIndex == 0)
			{
				frmRepEqualDebt.reportTitle = "BẢNG CÔNG NỢ KHÁCH HÀNG";
			}
			else
			{
				frmRepEqualDebt.reportTitle = "BẢNG CÔNG NỢ NHÀ CUNG CẤP";
			}
			frmRepEqualDebt.objTable = new DataTable();
			frmEqualDebtView frmEqualDebtView = new frmEqualDebtView();
			frmRepEqualDebt.objTable = this.objTable;
			frmEqualDebtView.totalMoney = this.txtAllMoney.Text;
			frmEqualDebtView.ShowDialog();
		}
		private void getBillInput()
		{
			this.dgvBill.AutoGenerateColumns = false;
			SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
			string cmdText = string.Concat(new string[]
			{
				"SELECT * FROM [TabBill] WHERE TypeInput NOT IN ('OUT4') AND ([PID] = '",
				this.currPid,
				"' OR [PID] = '",
				this.currCusID,
				"') ORDER BY [CreateDate] DESC"
			});
			SqlCommand selectCommand = new SqlCommand(cmdText, sqlConnection);
			SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(selectCommand);
			DataSet dataSet = new DataSet();
			sqlConnection.Open();
			sqlDataAdapter.Fill(dataSet);
			this.dgvBill.DataSource = dataSet.Tables[0];
			sqlConnection.Close();
			sqlConnection.Dispose();
			sqlDataAdapter.Dispose();
			dataSet.Dispose();
		}
		private void dgvProduct_CellClick(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				this.currPid = this.dgvProduct.Rows[e.RowIndex].Cells["ProID"].Value.ToString();
			}
			catch
			{
				this.currPid = "TVS-000";
			}
			try
			{
				this.currCusID = this.dgvProduct.Rows[e.RowIndex].Cells["CusID"].Value.ToString();
			}
			catch
			{
				this.currCusID = "TVS-000";
			}
		}
		private void dgvProduct_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				this.currPid = this.dgvProduct.Rows[e.RowIndex].Cells["ProID"].Value.ToString();
			}
			catch
			{
				this.currPid = "TVS-000";
			}
			try
			{
				this.currCusID = this.dgvProduct.Rows[e.RowIndex].Cells["CusID"].Value.ToString();
			}
			catch
			{
				this.currCusID = "TVS-000";
			}
			if (this.currPid != "" || this.currCusID != "")
			{
				this.getBillInput();
			}
		}
		private void btnExportToExcel_Click(object sender, EventArgs e)
		{
			try
			{
				frmRepEqualDebt.reportRangeTime = "Từ ngày : " + this.dtpFrom.Text + " đến " + this.dtpTo.Text;
				if (this.cbbObject.SelectedIndex == 0)
				{
					frmRepEqualDebt.reportTitle = "BẢNG CÔNG NỢ KHÁCH HÀNG";
				}
				else
				{
					frmRepEqualDebt.reportTitle = "BẢNG CÔNG NỢ NHÀ CUNG CẤP";
				}
				frmRepEqualDebt.objTable = new DataTable();
				frmRepEqualDebt.objTable = this.objTable;
				ActiveReport3 activeReport = new frmRepEqualDebt();
				activeReport.Run();
				XlsExport xlsExport = new XlsExport();
				SaveFileDialog saveFileDialog = new SaveFileDialog();
				saveFileDialog.ShowDialog();
				string text = saveFileDialog.FileName;
				if (text != "")
				{
					if (!text.ToUpper().Contains(".XLS"))
					{
						text += ".xls";
					}
					xlsExport.Export(activeReport.Document, text);
					MessageBox.Show("Hệ thống đã hoàn thành việc xuất dữ liệu ra file Excel", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
				}
				else
				{
					MessageBox.Show("Bạn chưa chọn đường dẫn và tên file cần xuất!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				}
			}
			catch
			{
			}
		}
		private void cbbObject_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.isPostBack)
			{
				this.getData();
			}
		}
		private void dtpFrom_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.getData();
			}
		}
		private void dtpTo_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Return)
			{
				this.getData();
			}
		}
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle9 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle10 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle11 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmEqualDebt));
			this.dgvProduct = new DataGridView();
			this.Column7 = new DataGridViewTextBoxColumn();
			this.Column2 = new DataGridViewTextBoxColumn();
			this.firstBalance = new DataGridViewTextBoxColumn();
			this.debtInTime = new DataGridViewTextBoxColumn();
			this.MoneyHaveInTime = new DataGridViewTextBoxColumn();
			this.CollectionInTime = new DataGridViewTextBoxColumn();
			this.MoneyPayedInTime = new DataGridViewTextBoxColumn();
			this.Balancer = new DataGridViewTextBoxColumn();
			this.ProID = new DataGridViewTextBoxColumn();
			this.CusID = new DataGridViewTextBoxColumn();
			this.btnPrint = new Button();
			this.btnClose = new Button();
			this.txtAllMoney = new System.Windows.Forms.TextBox();
			this.dgvBill = new DataGridView();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
			this.Column10 = new DataGridViewTextBoxColumn();
			this.Column11 = new DataGridViewTextBoxColumn();
			this.Column12 = new DataGridViewTextBoxColumn();
			this.Column13 = new DataGridViewTextBoxColumn();
			this.Column14 = new DataGridViewTextBoxColumn();
			this.Note = new DataGridViewTextBoxColumn();
			this.TotalMoney = new DataGridViewTextBoxColumn();
			this.label2 = new System.Windows.Forms.Label();
			this.btnExportToExcel = new Button();
			this.groupBox1 = new GroupBox();
			this.label25 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.dtpTo = new DateTimePicker();
			this.dtpFrom = new DateTimePicker();
			this.txtSearch = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.cbbObject = new ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			((ISupportInitialize)this.dgvBill).BeginInit();
			this.groupBox1.SuspendLayout();
			base.SuspendLayout();
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeight = 26;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.Column7,
				this.Column2,
				this.firstBalance,
				this.debtInTime,
				this.MoneyHaveInTime,
				this.CollectionInTime,
				this.MoneyPayedInTime,
				this.Balancer,
				this.ProID,
				this.CusID
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(7, 78);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProduct.RowTemplate.DefaultCellStyle.BackColor = Color.White;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(886, 260);
			this.dgvProduct.TabIndex = 3;
			this.dgvProduct.CellClick += new DataGridViewCellEventHandler(this.dgvProduct_CellClick);
			this.dgvProduct.CellEnter += new DataGridViewCellEventHandler(this.dgvProduct_CellEnter);
			this.Column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column7.DataPropertyName = "Name";
			dataGridViewCellStyle2.Format = "D";
			dataGridViewCellStyle2.NullValue = null;
			this.Column7.DefaultCellStyle = dataGridViewCellStyle2;
			this.Column7.HeaderText = "Khách hàng / Nhà cung cấp";
			this.Column7.MinimumWidth = 270;
			this.Column7.Name = "Column7";
			this.Column7.ReadOnly = true;
			this.Column7.Width = 270;
			this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Column2.DataPropertyName = "Address";
			this.Column2.HeaderText = "Địa chỉ";
			this.Column2.MinimumWidth = 100;
			this.Column2.Name = "Column2";
			this.Column2.ReadOnly = true;
			this.firstBalance.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.firstBalance.DataPropertyName = "realFirstBalancer";
			dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle3.Format = "N2";
			dataGridViewCellStyle3.NullValue = "0";
			this.firstBalance.DefaultCellStyle = dataGridViewCellStyle3;
			this.firstBalance.HeaderText = "Dư đầu kỳ";
			this.firstBalance.MinimumWidth = 120;
			this.firstBalance.Name = "firstBalance";
			this.firstBalance.ReadOnly = true;
			this.firstBalance.Width = 120;
			this.debtInTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.debtInTime.DataPropertyName = "debtInTime";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle4.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle4.ForeColor = Color.Red;
			dataGridViewCellStyle4.Format = "N2";
			dataGridViewCellStyle4.NullValue = "0";
			this.debtInTime.DefaultCellStyle = dataGridViewCellStyle4;
			this.debtInTime.HeaderText = "Nợ trong kỳ";
			this.debtInTime.MinimumWidth = 120;
			this.debtInTime.Name = "debtInTime";
			this.debtInTime.ReadOnly = true;
			this.debtInTime.Width = 120;
			this.MoneyHaveInTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.MoneyHaveInTime.DataPropertyName = "MoneyHaveInTime";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle5.ForeColor = Color.Blue;
			dataGridViewCellStyle5.Format = "N2";
			dataGridViewCellStyle5.NullValue = "0";
			this.MoneyHaveInTime.DefaultCellStyle = dataGridViewCellStyle5;
			this.MoneyHaveInTime.HeaderText = "Có trong kỳ";
			this.MoneyHaveInTime.MinimumWidth = 120;
			this.MoneyHaveInTime.Name = "MoneyHaveInTime";
			this.MoneyHaveInTime.ReadOnly = true;
			this.MoneyHaveInTime.Width = 120;
			this.CollectionInTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.CollectionInTime.DataPropertyName = "CollectionInTime";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle6.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle6.Format = "N2";
			dataGridViewCellStyle6.NullValue = "0";
			this.CollectionInTime.DefaultCellStyle = dataGridViewCellStyle6;
			this.CollectionInTime.HeaderText = "Thu trong kỳ";
			this.CollectionInTime.MinimumWidth = 120;
			this.CollectionInTime.Name = "CollectionInTime";
			this.CollectionInTime.ReadOnly = true;
			this.CollectionInTime.Width = 120;
			this.MoneyPayedInTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.MoneyPayedInTime.DataPropertyName = "MoneyPayedInTime";
			dataGridViewCellStyle7.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle7.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle7.Format = "N2";
			dataGridViewCellStyle7.NullValue = "0";
			this.MoneyPayedInTime.DefaultCellStyle = dataGridViewCellStyle7;
			this.MoneyPayedInTime.HeaderText = "Trả trong kỳ";
			this.MoneyPayedInTime.MinimumWidth = 120;
			this.MoneyPayedInTime.Name = "MoneyPayedInTime";
			this.MoneyPayedInTime.ReadOnly = true;
			this.MoneyPayedInTime.Width = 120;
			this.Balancer.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Balancer.DataPropertyName = "Balancer";
			dataGridViewCellStyle8.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle8.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			dataGridViewCellStyle8.ForeColor = Color.Red;
			dataGridViewCellStyle8.Format = "N2";
			dataGridViewCellStyle8.NullValue = "0";
			this.Balancer.DefaultCellStyle = dataGridViewCellStyle8;
			this.Balancer.HeaderText = "Dư cuối kỳ";
			this.Balancer.MinimumWidth = 120;
			this.Balancer.Name = "Balancer";
			this.Balancer.ReadOnly = true;
			this.Balancer.Width = 120;
			this.ProID.DataPropertyName = "ProID";
			this.ProID.HeaderText = "ProID";
			this.ProID.Name = "ProID";
			this.ProID.ReadOnly = true;
			this.ProID.Visible = false;
			this.CusID.DataPropertyName = "CusID";
			this.CusID.HeaderText = "CusID";
			this.CusID.Name = "CusID";
			this.CusID.ReadOnly = true;
			this.CusID.Visible = false;
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(9, 343);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(102, 26);
			this.btnPrint.TabIndex = 45;
			this.btnPrint.Text = "Xem và in [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = true;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(791, 565);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(102, 26);
			this.btnClose.TabIndex = 44;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.txtAllMoney.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtAllMoney.BackColor = Color.White;
			this.txtAllMoney.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
			this.txtAllMoney.ForeColor = Color.Red;
			this.txtAllMoney.Location = new System.Drawing.Point(771, 347);
			this.txtAllMoney.Name = "txtAllMoney";
			this.txtAllMoney.ReadOnly = true;
			this.txtAllMoney.Size = new Size(119, 22);
			this.txtAllMoney.TabIndex = 46;
			this.txtAllMoney.TextAlign = HorizontalAlignment.Right;
			this.dgvBill.AllowUserToAddRows = false;
			this.dgvBill.AllowUserToDeleteRows = false;
			this.dgvBill.AllowUserToOrderColumns = true;
			this.dgvBill.AllowUserToResizeColumns = false;
			this.dgvBill.AllowUserToResizeRows = false;
			dataGridViewCellStyle9.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle9.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
			this.dgvBill.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvBill.BackgroundColor = Color.White;
			this.dgvBill.BorderStyle = BorderStyle.Fixed3D;
			this.dgvBill.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvBill.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dataGridViewTextBoxColumn1,
				this.dataGridViewTextBoxColumn7,
				this.Column10,
				this.Column11,
				this.Column12,
				this.Column13,
				this.Column14,
				this.Note,
				this.TotalMoney
			});
			this.dgvBill.Cursor = Cursors.Hand;
			this.dgvBill.EnableHeadersVisualStyles = false;
			this.dgvBill.Location = new System.Drawing.Point(6, 378);
			this.dgvBill.MultiSelect = false;
			this.dgvBill.Name = "dgvBill";
			this.dgvBill.ReadOnly = true;
			this.dgvBill.RowHeadersVisible = false;
			this.dgvBill.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvBill.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvBill.Size = new Size(887, 181);
			this.dgvBill.TabIndex = 49;
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
			this.dataGridViewTextBoxColumn1.HeaderText = "Hoá đơn";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 150;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn1.ReadOnly = true;
			this.dataGridViewTextBoxColumn1.Width = 150;
			this.dataGridViewTextBoxColumn7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn7.DataPropertyName = "CreateDate";
			dataGridViewCellStyle10.Format = "D";
			dataGridViewCellStyle10.NullValue = null;
			this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle10;
			this.dataGridViewTextBoxColumn7.HeaderText = "Ngày lập";
			this.dataGridViewTextBoxColumn7.MinimumWidth = 120;
			this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
			this.dataGridViewTextBoxColumn7.ReadOnly = true;
			this.dataGridViewTextBoxColumn7.Width = 120;
			this.Column10.DataPropertyName = "TotalMoney";
			this.Column10.HeaderText = "TotalMoney";
			this.Column10.Name = "Column10";
			this.Column10.ReadOnly = true;
			this.Column10.Visible = false;
			this.Column11.DataPropertyName = "TypeInput";
			this.Column11.HeaderText = "TypeInput";
			this.Column11.Name = "Column11";
			this.Column11.ReadOnly = true;
			this.Column11.Visible = false;
			this.Column12.DataPropertyName = "WID";
			this.Column12.HeaderText = "WID";
			this.Column12.Name = "Column12";
			this.Column12.ReadOnly = true;
			this.Column12.Visible = false;
			this.Column13.DataPropertyName = "Note";
			this.Column13.HeaderText = "Note";
			this.Column13.Name = "Column13";
			this.Column13.ReadOnly = true;
			this.Column13.Visible = false;
			this.Column14.DataPropertyName = "PID";
			this.Column14.HeaderText = "PID";
			this.Column14.Name = "Column14";
			this.Column14.ReadOnly = true;
			this.Column14.Visible = false;
			this.Note.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Note.DataPropertyName = "Note";
			this.Note.HeaderText = "Diễn giải";
			this.Note.MinimumWidth = 250;
			this.Note.Name = "Note";
			this.Note.ReadOnly = true;
			this.TotalMoney.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.TotalMoney.DataPropertyName = "TotalMoney";
			dataGridViewCellStyle11.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle11.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.TotalMoney.DefaultCellStyle = dataGridViewCellStyle11;
			this.TotalMoney.HeaderText = "Tổng tiền";
			this.TotalMoney.MinimumWidth = 120;
			this.TotalMoney.Name = "TotalMoney";
			this.TotalMoney.ReadOnly = true;
			this.TotalMoney.Width = 120;
			this.label2.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label2.AutoSize = true;
			this.label2.BackColor = Color.White;
			this.label2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label2.Location = new System.Drawing.Point(679, 350);
			this.label2.Name = "label2";
			this.label2.Size = new Size(91, 15);
			this.label2.TabIndex = 52;
			this.label2.Text = "Tổng công nợ :";
			this.btnExportToExcel.Enabled = false;
			this.btnExportToExcel.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnExportToExcel.FlatStyle = FlatStyle.Flat;
			this.btnExportToExcel.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnExportToExcel.Location = new System.Drawing.Point(112, 343);
			this.btnExportToExcel.Name = "btnExportToExcel";
			this.btnExportToExcel.Size = new Size(102, 26);
			this.btnExportToExcel.TabIndex = 53;
			this.btnExportToExcel.Text = "Xuất file Excel";
			this.btnExportToExcel.UseVisualStyleBackColor = true;
			this.btnExportToExcel.Click += new EventHandler(this.btnExportToExcel_Click);
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.label25);
			this.groupBox1.Controls.Add(this.label17);
			this.groupBox1.Controls.Add(this.dtpTo);
			this.groupBox1.Controls.Add(this.dtpFrom);
			this.groupBox1.Controls.Add(this.txtSearch);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.cbbObject);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new System.Drawing.Point(6, 2);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(887, 70);
			this.groupBox1.TabIndex = 54;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Thông tin tìm kiếm";
			this.label25.AutoSize = true;
			this.label25.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label25.Location = new System.Drawing.Point(42, 31);
			this.label25.Name = "label25";
			this.label25.Size = new Size(59, 15);
			this.label25.TabIndex = 151;
			this.label25.Text = "Từ ngày :";
			this.label17.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
//			this.label17.Image = (Image)componentResourceManager.GetObject("label17.Image");
			this.label17.Location = new System.Drawing.Point(187, 27);
			this.label17.Name = "label17";
			this.label17.Size = new Size(20, 25);
			this.label17.TabIndex = 150;
			this.dtpTo.CustomFormat = "dd/MM/yyyy";
			this.dtpTo.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpTo.Format = DateTimePickerFormat.Custom;
			this.dtpTo.Location = new System.Drawing.Point(209, 28);
			this.dtpTo.Name = "dtpTo";
			this.dtpTo.Size = new Size(81, 21);
			this.dtpTo.TabIndex = 149;
			this.dtpTo.KeyDown += new KeyEventHandler(this.dtpTo_KeyDown);
			this.dtpFrom.CustomFormat = "dd/MM/yyyy";
			this.dtpFrom.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpFrom.Format = DateTimePickerFormat.Custom;
			this.dtpFrom.Location = new System.Drawing.Point(103, 28);
			this.dtpFrom.Name = "dtpFrom";
			this.dtpFrom.Size = new Size(81, 21);
			this.dtpFrom.TabIndex = 148;
			this.dtpFrom.KeyDown += new KeyEventHandler(this.dtpFrom_KeyDown);
			this.txtSearch.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtSearch.Font = new Font("Arial", 10f, FontStyle.Bold);
			this.txtSearch.Location = new System.Drawing.Point(661, 27);
			this.txtSearch.Name = "txtSearch";
			this.txtSearch.Size = new Size(208, 23);
			this.txtSearch.TabIndex = 65;
			this.label1.AutoSize = true;
			this.label1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label1.Location = new System.Drawing.Point(574, 31);
			this.label1.Name = "label1";
			this.label1.Size = new Size(83, 15);
			this.label1.TabIndex = 64;
			this.label1.Text = "Tìm theo tên :";
			this.cbbObject.BackColor = Color.White;
			this.cbbObject.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbObject.FlatStyle = FlatStyle.Flat;
			this.cbbObject.Font = new Font("Arial", 9f);
			this.cbbObject.FormattingEnabled = true;
			this.cbbObject.Items.AddRange(new object[]
			{
				"Khách hàng",
				"Nhà cung cấp"
			});
			this.cbbObject.Location = new System.Drawing.Point(378, 27);
			this.cbbObject.Name = "cbbObject";
			this.cbbObject.Size = new Size(191, 23);
			this.cbbObject.TabIndex = 63;
			this.cbbObject.SelectedIndexChanged += new EventHandler(this.cbbObject_SelectedIndexChanged);
			this.label3.AutoSize = true;
			this.label3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label3.Location = new System.Drawing.Point(302, 31);
			this.label3.Name = "label3";
			this.label3.Size = new Size(71, 15);
			this.label3.TabIndex = 62;
			this.label3.Text = "Đối tượng :";
			this.label4.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.label4.BackColor = Color.White;
			this.label4.Location = new System.Drawing.Point(6, 341);
			this.label4.Name = "label4";
			this.label4.Size = new Size(888, 34);
			this.label4.TabIndex = 55;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.btnExportToExcel);
			base.Controls.Add(this.label2);
			base.Controls.Add(this.dgvBill);
			base.Controls.Add(this.txtAllMoney);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.dgvProduct);
			base.Controls.Add(this.label4);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmEqualDebt";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "QUẢN LÝ CÔNG NỢ";
			base.WindowState = FormWindowState.Maximized;
			base.Load += new EventHandler(this.frmDebtNeedIn_Load);
			base.KeyDown += new KeyEventHandler(this.frmDebtNeedIn_KeyDown);
			((ISupportInitialize)this.dgvProduct).EndInit();
			((ISupportInitialize)this.dgvBill).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
	}
}
